﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAO
{
    public static class NguyenVatLieuDAO
    {
        public static QL_HuongRungEntities db = new QL_HuongRungEntities();

        public static List<NGUYENVATLIEU> layDSNVL()
        {
            List<NGUYENVATLIEU> arrNVL = db.NGUYENVATLIEU.ToList();
            return arrNVL;
        }

        public static NGUYENVATLIEU layNVL(int maNVL)
        {
            NGUYENVATLIEU nvl = db.NGUYENVATLIEU.Find(maNVL);
            return nvl;
        }

        public static int layMaNVLLonNhat()
        {
            try
            {
                int maNVL = db.NGUYENVATLIEU.Max(p => p.MaNVL);
                return maNVL;
            }
            catch (Exception ex)
            {
                return 0;
            }
        }
    }
}
